#ifndef QIPAN_H
#define QIPAN_H

#include <QObject>
#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
#include <QMouseEvent>
#include <QVector>
#include "stdshared.h"
#include <QMap>




class qipan : public QWidget
{
    Q_OBJECT
public:
    explicit qipan(QWidget *parent = nullptr);

public:
    /* 记录棋盘位置对应的棋子的玩家 */
    void setBoardInfo(int row,int col,Role role);

    /* 得到棋盘的信息 */
    Role ** getBoardInfo(int & boardSize);

    /* 获取棋盘尺寸 */
    int getBoardSize();

    /* 初始化棋盘 */
    void initBoard();
protected:
    /* 绘画事件 */
    void paintEvent(QPaintEvent * event);
    /* 鼠标移动事件 */
    void mouseMoveEvent(QMouseEvent * event);
    /* 鼠标点击事件 */
    void mousePressEvent(QMouseEvent * event);




signals:
    /* 发送落子信号 */
    void chessClick(int row,int col);

public slots:

public:
    int flag;
private:
    static const int m_boardSize = 15;
    static const int m_cellSize = 40;
    static const int m_magin = m_cellSize / 2;

    /* 玩家是1，人机是2 */
    Role **m_board;

    /* 悬停坐标 */
    int m_hoverRow;
    int m_hoverCol;

    bool m_hoverFlg;


};

#endif // QIPAN_H
